package util;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * Utilidade que sera usada no Projeto
 * @author Claudio Cardoso, Daniel Leite, Lucas Sampaio, Matheus Sampaio
 * @version 1.0
 */

public class Utils {
	/**
	 * @param data
	 * 			Recebe data no formato dd/mm/yyyy
	 * @param hora
	 * 			Recebe hora no formato hh/mm
	 * @return
	 * 			Calendar(year, month, dayOfMonth, hourOfDay, minute)
	 */
	public static Calendar criaCalendar(String data, String hora) {
		String[] dataArray = data.split("/", 3);
		int dayOfMonth	  = Integer.parseInt(dataArray[0]);
		int month = Integer.parseInt(dataArray[1]) - 1;
		int year  = Integer.parseInt(dataArray[2]);
		
		String[] horaArray = hora.split(":", 2);
		int hourOfDay = Integer.parseInt(horaArray[0]);
		int minute = Integer.parseInt(horaArray[1]);
		
		Calendar calendar = new GregorianCalendar(year, month, dayOfMonth, hourOfDay, minute);
		
		return calendar;
	}
}
